/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} head
 * @param {number} val
 * @return {ListNode}
 */
var deleteNode = function(head, val) {
    let dummy=new ListNode(0,head)
    head=dummy
    while(head.next){
        if(head.next.val===val){
            head.next=head.next.next
            return dummy.next
        }
        head=head.next
    }
};